UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PoKRL21qPCf2VYJ2SCF5m9Vr2z+utvgZICvyCP6vAug='
WHERE
key_id = 'b9ffbeeb4ab23dd825e89369372d5da6f729cfa229374321007e5d390f737fe0'
AND (
token = 'PoKRL21qPCf2VYJ2SCF5m9Vr2z+utvgZICvyCP6vAug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)