UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J5hpm+6pmUpYcZbBF1iABR3An84R9biwW4nDUyYCo+U=' 
WHERE 
  key_id = 'f1e5ff91504af12959b59fccd93976bb4f7d3409ba37f151d6b0150ec1186152' 
  AND (
    token = 'J5hpm+6pmUpYcZbBF1iABR3An84R9biwW4nDUyYCo+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050