UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8UFwL5a+TO7MMaFphImpFnNMFD7mF4XEsGvkf+h+dMU='
WHERE
key_id = 'c3446f2e7eb2b9bef9acec25223811c13b851432222e53c6d00f64e12f3b3adf'
AND (
token = '8UFwL5a+TO7MMaFphImpFnNMFD7mF4XEsGvkf+h+dMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)