UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O+4MrE8H+rlB6OYZ8pr4JRFltizK3TDL8VF+GgqFUGw=' 
WHERE 
  key_id = '6ab87e9a5174062de2a227e594558267576c4b48cb71a57889fb1bfd43030ee6' 
  AND (
    token = 'O+4MrE8H+rlB6OYZ8pr4JRFltizK3TDL8VF+GgqFUGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027