UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YZLGFT8AyiIE/OSk3ujFLRpObwnHPeBSkGcIpN4pBy8='
WHERE
key_id = '792f3258794ef5d8404ac93df4fcd256a656da349d56c8807322a28a731d4c0c'
AND (
token = 'YZLGFT8AyiIE/OSk3ujFLRpObwnHPeBSkGcIpN4pBy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)