UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'twHI7sOy2iFQOXeG1ILGdkv7JPTXGxJQyM5g81BbShc='
WHERE
key_id = '791c28e71b9c3ec1d2421c308687a9358bd91fe6201738c068dd8a37eeccd346'
AND (
token = 'twHI7sOy2iFQOXeG1ILGdkv7JPTXGxJQyM5g81BbShc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)