UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eZaAKFES0ygLT3fsIkwuFfSDE5VICJ4gDGcJyf17ggA='
WHERE
key_id = '25a31bee87949172b1070ac4951b85786cdc85363ad2ab9e0906140c17b38667'
AND (
token = 'eZaAKFES0ygLT3fsIkwuFfSDE5VICJ4gDGcJyf17ggA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)