UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LsbQnzdhwvlr0V510NhEW6k5nes4mP8o1CXxFMfxiw8='
WHERE
key_id = '9391dc649523b05cd17e8bcebfd8cb5845e8503996c7676eaf449e17706fbae5'
AND (
token = 'LsbQnzdhwvlr0V510NhEW6k5nes4mP8o1CXxFMfxiw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)