UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LUHy+wuOQrJuPlg6AivitQ68fs5heMYkfRL0q7NXA+A=' 
WHERE 
  key_id = 'f1d498cb46662a4c123c19fe8b60a73a2f79cc448214ecb8aa32436956f80d3d' 
  AND (
    token = 'LUHy+wuOQrJuPlg6AivitQ68fs5heMYkfRL0q7NXA+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043