UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e6TvwLcgNUDS7u7ZiX8E1XHck5janDBTtCCAKs88I5o='
WHERE
key_id = 'c4e56f512c1f4077f772d6836f97cc680b8d846dea208781afe579ab6ce9c1b6'
AND (
token = 'e6TvwLcgNUDS7u7ZiX8E1XHck5janDBTtCCAKs88I5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)