UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtUBBu2Si6gC6hlMWWicpCJk47ylx/sb6M1phnvUrHA='
WHERE
key_id = '55d12fa16c78a219b864636effeeb1c12e576f25e4718104ef10e1d896000a18'
AND (
token = 'YtUBBu2Si6gC6hlMWWicpCJk47ylx/sb6M1phnvUrHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)