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