UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HWPy+PhqRFWOvzT2AYwtqI46NEiXr4riYP0WsiHQlUw='
WHERE
key_id = 'a669ec95b4055598eb8ee24e5b93974c7491661d73466032b15da651361734d9'
AND (
token = 'HWPy+PhqRFWOvzT2AYwtqI46NEiXr4riYP0WsiHQlUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)