UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JqJAdzx2BmtAzY0VbbsRee539dlA9I/7g+bP8mJcjAA=' 
WHERE 
  key_id = '39f9c80a7fbfc94fb8be3e80f9d04f3be93a6c19319637b716166ef13a67d57c' 
  AND (
    token = 'JqJAdzx2BmtAzY0VbbsRee539dlA9I/7g+bP8mJcjAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028