UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/uRm7cPzi8BbwrYpGSx7GvbpluqV3gXTwBZdWCFrwM=' 
WHERE 
  key_id = '9b9dfbe9d18c5b5a7e9534e3026262015c997b3bfdefa78eea3b16651f490785' 
  AND (
    token = 'm/uRm7cPzi8BbwrYpGSx7GvbpluqV3gXTwBZdWCFrwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037