UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nu3habVX3o1GMRmN9mMf9Cm/UBsFkR9NL/hVN7iXzPQ=' 
WHERE 
  key_id = 'bafb09f04a97fdbaee70c2b4a09a9c80afc2b415dcacdc76f138d7b6ca202e14' 
  AND (
    token = 'nu3habVX3o1GMRmN9mMf9Cm/UBsFkR9NL/hVN7iXzPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015