UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's1ZzEfsPHlk+rF1o/boHM3nzaWO/SnEIsgwQd+sSi9A=' 
WHERE 
  key_id = '48983a0b959f14749be78aeaa06f7e408b4700882976255977f11e287a403c7a' 
  AND (
    token = 's1ZzEfsPHlk+rF1o/boHM3nzaWO/SnEIsgwQd+sSi9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037