UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TOxTTt07hgm7OZXnkgmkxUeiMrzhg2zmZH26D9WsGZI='
WHERE
key_id = '7b5ae8649a397208d77b902d6606980ebdf99249d825e36c8514b8783b8ce44d'
AND (
token = 'TOxTTt07hgm7OZXnkgmkxUeiMrzhg2zmZH26D9WsGZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)