UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ddRjiHmhVyozecBOV7hGwhu3FrVAg1kpe/2MKeLF+8g=' 
WHERE 
  key_id = 'ba7b8b23ccb9f2910390529dd0a300efa4ef5143f3220b43202097458b969359' 
  AND (
    token = 'ddRjiHmhVyozecBOV7hGwhu3FrVAg1kpe/2MKeLF+8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022