UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dTgDegnCnnwFfdZGPMzXM4KgpscZ2/TT9Xp8b4mG3no='
WHERE
key_id = '46f3b9b5b3548e473691b256a788119cb5c3a85782e687f2c49a769f8a05ef95'
AND (
token = 'dTgDegnCnnwFfdZGPMzXM4KgpscZ2/TT9Xp8b4mG3no='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)