UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BawtQSHhzD46ERlXRK41P8MeAshboXMpH+BBx41Ap/c=' 
WHERE 
  key_id = 'd37cd606b6b0d6a1520006c58ad449b33e3ea157440f68d427df7bf57ff9e41c' 
  AND (
    token = 'BawtQSHhzD46ERlXRK41P8MeAshboXMpH+BBx41Ap/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050