UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3EIqOtRlWnuWN2ljYxy1UtkdBz8/XV+e8tO2Ot2slM=' 
WHERE 
  key_id = '72543e2269e81d61b3ed6545cd998008dc231c1dd45ce575f6f8c17f2c269a99' 
  AND (
    token = 'T3EIqOtRlWnuWN2ljYxy1UtkdBz8/XV+e8tO2Ot2slM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025