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