UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lVffgZYuST+NpXuxv5jcaMgU1mILT9KvBAWlO6HNLcg='
WHERE
key_id = 'a007d675fd797523cb31f28650b3300a8732ac5a590a9e4884006c24b7cf1f89'
AND (
token = 'lVffgZYuST+NpXuxv5jcaMgU1mILT9KvBAWlO6HNLcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)