UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWga9kQ7cv7G4Axy5Cg5MY1d+CRNi3rN6AF4xllYmuQ=' 
WHERE 
  key_id = '277bfcc1ed6356980e7b02db97e06c88cfd5ffd2806e358d9eb7e7fc9bb5865a' 
  AND (
    token = 'YWga9kQ7cv7G4Axy5Cg5MY1d+CRNi3rN6AF4xllYmuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00096