UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '81V00MspHBnsm59AS8YAvtuNe1BNP5P2oqt89BztQW8=' 
WHERE 
  key_id = 'c3852a95087036a5e57126a18d156d835eb06f9630c16408acc02eb6ce5308d9' 
  AND (
    token = '81V00MspHBnsm59AS8YAvtuNe1BNP5P2oqt89BztQW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064