UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHDEqYzGzanp5lsPa93J32joXrA3Iis9nGjI4Ed+Hb8=' 
WHERE 
  key_id = '69db7b8517cb91678740181dec8b953ba052a4058dc9143c693985c1c0153daa' 
  AND (
    token = 'oHDEqYzGzanp5lsPa93J32joXrA3Iis9nGjI4Ed+Hb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035