UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ay+p0mS4QVsmtACW27DFM0UAqAMC7+Ljg3NNdEqB+U0=' 
WHERE 
  key_id = 'deadbcf573fbb94c3102f0c960d03637211e26cc5a3933f123b88f8f8a992d59' 
  AND (
    token = 'Ay+p0mS4QVsmtACW27DFM0UAqAMC7+Ljg3NNdEqB+U0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033