UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QsO/+21is/a/ul21GUOblUt4DfkZMmzedIMF+AmuNjE=' 
WHERE 
  key_id = 'c2e9017026884c6864024ed9b46f1a71e6e9205e91f9a82174977b11ec55fc04' 
  AND (
    token = 'QsO/+21is/a/ul21GUOblUt4DfkZMmzedIMF+AmuNjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022