UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GZrmmlYdnCNNItqoEr2mJeSkk9mCszgOaCY9h2kmbOw='
WHERE
key_id = '76c651d7eb9a727e123128a9b7f7d0742038708a875daabcd1636ee21349efe7'
AND (
token = 'GZrmmlYdnCNNItqoEr2mJeSkk9mCszgOaCY9h2kmbOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)