UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nzi1Mw0wabniAnE9Iwe3c+gTlI96F7jmnNhRifLGBw4='
WHERE
key_id = 'd041467edef24090c144c0c982f542b3184384cb58456c2b69489511c1521f39'
AND (
token = 'nzi1Mw0wabniAnE9Iwe3c+gTlI96F7jmnNhRifLGBw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)