UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l8VjJtv6yobvzw+FNv8f5HFoQCouR4cH8RKNn/S6U3w='
WHERE
key_id = 'f8d56376ae2ea55b8f54ec5f2dc8eb169da0b1e73ffc7a2a508a7c42cc6a3d6f'
AND (
token = 'l8VjJtv6yobvzw+FNv8f5HFoQCouR4cH8RKNn/S6U3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)