UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DLZVc4q7emP+amA8Cj8C92FTmiMNbHZKUI6WvX0kSSk='
WHERE
key_id = 'a883c72e6168c313be36a3d4512a614ef84a01c13836a0492f917e4f31ee9f92'
AND (
token = 'DLZVc4q7emP+amA8Cj8C92FTmiMNbHZKUI6WvX0kSSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)