UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aBe3y48nm/w8OD860WlKFTn1+4melAor77XBhjgUEGU=' 
WHERE 
  key_id = '6ceddf22a3cd687d81b5cce4e272b49e92eef58d5d262a2a067141808297562b' 
  AND (
    token = 'aBe3y48nm/w8OD860WlKFTn1+4melAor77XBhjgUEGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018