UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJi9XVL9Efr4IA3mpbHoSFhS7Ztx9GyPsFn5YkR2SaQ=' 
WHERE 
  key_id = 'd938f6a547c6b91587af9154e3d9ca63ec2e7255108c38c4885c753578a0dd61' 
  AND (
    token = 'XJi9XVL9Efr4IA3mpbHoSFhS7Ztx9GyPsFn5YkR2SaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066