UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cMSmXqPYYgZ6CmQhN4XbWD2uJnJsyZW5bV0YFavY0k4=' 
WHERE 
  key_id = '5b7baf7e957477f07349888d4555a736d890fd971e4530b0dd71b4cd053b47fc' 
  AND (
    token = 'cMSmXqPYYgZ6CmQhN4XbWD2uJnJsyZW5bV0YFavY0k4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00084