UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iB4XR+8z5M+EB+ZXazsytkzgGfdlxoLAcarc03pQxGQ=' 
WHERE 
  key_id = '0c4dc94e5d4498649ea4fc0091af87c280a5c9d51560f31578fb59a23944519f' 
  AND (
    token = 'iB4XR+8z5M+EB+ZXazsytkzgGfdlxoLAcarc03pQxGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018