UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WAMARz2LHoRbB9OT2onLSTP1fKqYpGRvopPbOpYVaaA=' 
WHERE 
  key_id = 'a0def98ebc83acfad5c887be8a9888b183dcc7fd4888cda13e0d05f9d6390fef' 
  AND (
    token = 'WAMARz2LHoRbB9OT2onLSTP1fKqYpGRvopPbOpYVaaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055