UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gSKC5Dld8iWjU6ipH241Weqro9oqmqsn6DrMrL+4ANk='
WHERE
key_id = '7ecc83dd51a844f5531e4fc0c6359f79ff8e5b42ba337fc84b61339fd67d7ccc'
AND (
token = 'gSKC5Dld8iWjU6ipH241Weqro9oqmqsn6DrMrL+4ANk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)