UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xqY81+e2Go+6qvxcPZf38HHzCqwd4GDdQJx+JyeCbmw=' 
WHERE 
  key_id = 'b64ac07daacea06ccb5bc4876668e41ab6b08c3eff8f35707b8e095120a77c6f' 
  AND (
    token = 'xqY81+e2Go+6qvxcPZf38HHzCqwd4GDdQJx+JyeCbmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020