UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hN/Hs5FC3ou5qIHtn/Bc1c+aVhehK8AoqYi6f07fEO4='
WHERE
key_id = 'f151925ea44cbfcc5ee7e35793f03797eeee5c8578945cf4aa756d37990c7d10'
AND (
token = 'hN/Hs5FC3ou5qIHtn/Bc1c+aVhehK8AoqYi6f07fEO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)