UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vIb8DDAcf8Bj1FhAg96Uj/V02AVmdiDFqeuwcBlXPXg=' 
WHERE 
  key_id = 'c0bb4fd45f416be62541d7bedc2eb60123d7ea77cae99a3ac5629fe29679df55' 
  AND (
    token = 'vIb8DDAcf8Bj1FhAg96Uj/V02AVmdiDFqeuwcBlXPXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028