UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BrVvH/Bf/iQ3Tv5YMpEBl3v7XaUzpyBwmWXvNwEiEp0='
WHERE
key_id = '581b8e0396599d75908d0ef5c9915a52a80074622015bfce194c8849aa77a03a'
AND (
token = 'BrVvH/Bf/iQ3Tv5YMpEBl3v7XaUzpyBwmWXvNwEiEp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)