UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwFb0hB6tZtxoN/ejXRW2wZcYZeN31FErqZwbYnH1Uk=' 
WHERE 
  key_id = 'e0e4696d9872306f1a1f7c32346abd22d43e87e14e8eade37084818a806a200a' 
  AND (
    token = 'RwFb0hB6tZtxoN/ejXRW2wZcYZeN31FErqZwbYnH1Uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049