UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kZgAVV0nAHMTzsRl3n578D5sJUodcb00UbKY7wLD7uI=' 
WHERE 
  key_id = '18c040fd0f48e1a86a78e1e880f8357532723bb6842379b949071a9ba760a638' 
  AND (
    token = 'kZgAVV0nAHMTzsRl3n578D5sJUodcb00UbKY7wLD7uI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027