UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7VPScuz6DB8BVUFpRki6xwwC6x1sdBRXIDKgmOTT7rc='
WHERE
key_id = 'a257fd266b81311dfe574d5345dd78b1ecf24ad02f1928ca98478a247a82ea7a'
AND (
token = '7VPScuz6DB8BVUFpRki6xwwC6x1sdBRXIDKgmOTT7rc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)