UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZTph/g4TaB3xo+AEZ8K4whi9qe7ns7t/lBSBUV2rJHg='
WHERE
key_id = '6f36c7d55b4eead45373ded770b4d2f5c6664df05b4db1619d88a697d11afd0d'
AND (
token = 'ZTph/g4TaB3xo+AEZ8K4whi9qe7ns7t/lBSBUV2rJHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)