UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Km14IZ9BVVl7C+8kfDntrv1d00/sG6wc8oh0WpVUZd0='
WHERE
key_id = '1220ecd709819c1fda6944881e3d130a805bc9d97f53d6b8e3ceb3285e871334'
AND (
token = 'Km14IZ9BVVl7C+8kfDntrv1d00/sG6wc8oh0WpVUZd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)