UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UbPFCsy/gFLv0VvscHZygPoTDIuKJ8Wzo7KEaTWTQMU='
WHERE
key_id = 'b389f8740ce648b5511fc0fa01b5070fde020215ebb05eafcb381f46c09a7b06'
AND (
token = 'UbPFCsy/gFLv0VvscHZygPoTDIuKJ8Wzo7KEaTWTQMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)