UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRJEpEvWJc/09cjbo8Wwi+Epw9ECIh1XSUctNZa3zgk='
WHERE
key_id = '8359718bf509067cca67faa04e276d0d81f414b35650e8e6ea70f1e5abfd7fd9'
AND (
token = 'QRJEpEvWJc/09cjbo8Wwi+Epw9ECIh1XSUctNZa3zgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)