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