UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7joNBAJzb/Dm3SPFJpU84KS1Z1l+5OocGTgUj8iYJN8='
WHERE
key_id = '24f1166406efb091be9cd08930439a5e4ed4f54af4681e41415909f05ca1a336'
AND (
token = '7joNBAJzb/Dm3SPFJpU84KS1Z1l+5OocGTgUj8iYJN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)