UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V0f4qCxsX/pMQrwfe5HJ84Qh5D5jftE6wXDx8cx3nSo='
WHERE
key_id = 'eaac65247bb351486b34d8653886cd0f00a54686eb5703b7f7465ea97499b89d'
AND (
token = 'V0f4qCxsX/pMQrwfe5HJ84Qh5D5jftE6wXDx8cx3nSo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)