UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxrgMQtt0p/1AgG5+t6Bhypevwm2yf2ToIXC1eE/y2w=' 
WHERE 
  key_id = 'a1d5e16d72ab131acb089c521f9a82659c4d6900f8037d39df6e62032e711e21' 
  AND (
    token = 'xxrgMQtt0p/1AgG5+t6Bhypevwm2yf2ToIXC1eE/y2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036