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