UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nUt1VzQ7WcUKW1trm7yR4CnOlPIJdLR4hh2CONF66K8='
WHERE
key_id = 'a7992310c61455fd31686303ef688cae75ee4506d86f20602d102553156a03b9'
AND (
token = 'nUt1VzQ7WcUKW1trm7yR4CnOlPIJdLR4hh2CONF66K8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)